<template>
  <div>
    <component
      :is="h(ElInput, { ...$attrs, ...props, ref: changeRef }, $slots)"
    />
  </div>
</template>

<script setup lang="ts">
import { h, getCurrentInstance, ComponentInstance } from 'vue'
import { ElInput, type InputProps } from 'element-plus'

const props = defineProps<Partial<InputProps>>()

const vm = getCurrentInstance()
function changeRef(inputInstance: any) {
  vm!.exposeProxy = vm!.exposed = inputInstance || {}
}

defineExpose({} as ComponentInstance<typeof ElInput>)
</script>

<style scoped lang="scss"></style>
